package com.yztc.orangeentertainment.ui.main.findfragment.findpersenter;

import android.content.Context;

import com.yztc.orangeentertainment.bean.findbean.FindActivityBean;
import com.yztc.orangeentertainment.bean.findbean.FindBannerBean;
import com.yztc.orangeentertainment.bean.findbean.FindInteractBean;
import com.yztc.orangeentertainment.bean.findbean.FindStarBean;
import com.yztc.orangeentertainment.bean.findbean.FindStaractBean;
import com.yztc.orangeentertainment.bean.findbean.FindWewatchBean;
import com.yztc.orangeentertainment.config.SubscribeUrlConfig;
import com.yztc.orangeentertainment.ui.main.findfragment.findmodel.FindModle;
import com.yztc.orangeentertainment.ui.main.findfragment.findmodel.IFindModle;
import com.yztc.orangeentertainment.ui.main.findfragment.findmodel.OnLoadFindListener;
import com.yztc.orangeentertainment.ui.main.findfragment.findview.IFindView;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by My on 2016/10/6.
 */
public class FindPresenter {
    private IFindModle modle;
    private IFindView findView;

    public FindPresenter(IFindView view) {
        this.findView = view;
        this.modle = new FindModle();
    }

    public void getVerticalFromNet(final Context context) {
        Map<String, String> map = new HashMap<>();
        map.put(SubscribeUrlConfig.Params.MAC, SubscribeUrlConfig.All_DefaultVaule.MAC_VALUE);
        map.put(SubscribeUrlConfig.Params.UID, SubscribeUrlConfig.All_DefaultVaule.UID_VALUE);
        map.put(SubscribeUrlConfig.Params.PF, SubscribeUrlConfig.All_DefaultVaule.PF_VALUE);
        map.put(SubscribeUrlConfig.Params.NET, SubscribeUrlConfig.All_DefaultVaule.NET_VALUE);
        map.put(SubscribeUrlConfig.Params.ACCESSTOKEN, SubscribeUrlConfig.All_DefaultVaule
                .ACCESSTOKEN_VALUE);
        map.put(SubscribeUrlConfig.Params.CHANNEL, SubscribeUrlConfig.All_DefaultVaule
                .CHANNEL_VALUE);
        map.put(SubscribeUrlConfig.Params.VER, SubscribeUrlConfig.All_DefaultVaule.VER_VALUE);
        map.put(SubscribeUrlConfig.Params.RES, SubscribeUrlConfig.All_DefaultVaule.RES_VALUE);
        modle.LoadFindData("home", map, new OnLoadFindListener() {
            @Override
            public void onSuccess(List<FindBannerBean> findBannerBeens) {
                findView.onVerticalSucess(findBannerBeens);
            }

            @Override
            public void getWewatchList(List<FindWewatchBean> wewatchBeens) {
                findView.setRecycleviewAdapter(wewatchBeens);
            }

            @Override
            public void getInteractList(List<FindInteractBean> interactBeens) {
                findView.setFindInteract(interactBeens);
            }

            @Override
            public void getActivityList(List<FindActivityBean> activityBeens) {
                findView.setFindActivity(activityBeens);
            }

            @Override
            public void getStarList(List<FindStarBean> starBeens) {
                findView.setFindStar(starBeens);
            }

            @Override
            public void getStaract(FindStaractBean staractBeen) {
                findView.setFindStaract(staractBeen);
            }

            @Override
            public void onFailure(Exception e) {
                findView.onVerticalFail(e.getMessage());
            }
        });
    }

}
